package com.springboot.mybatis.service.Impl;

import com.springboot.mybatis.entity.Film;
import com.springboot.mybatis.mapper.FilmMapper;
import com.springboot.mybatis.service.FilmService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FilmServiceImpl implements FilmService {

    @Resource
    private FilmMapper filmMapper;

    @Override
    public List<Film> queryAll() {
        return filmMapper.selectAll();
    }

    @Override
    public Film queryById(Integer id) {
        return filmMapper.selectById(id);
    }

    @Override
    public List<Film> queryByTitle(String title) {
        return filmMapper.selectByTitle(title);
    }

    @Override
    public void addOne(Film film) {
        filmMapper.insertOne(film);
    }

    @Override
    public void modifyOne(Film film) {
        filmMapper.updateOne(film);
    }

    @Override
    public void removeOne(Integer id) {
        filmMapper.deleteOne(id);
    }
}
